//
//  DevelopFeeViewController.swift
//  HuaYun
//
//  Created by enghou on 2019/1/15.
//  Copyright © 2019 xyxorigation. All rights reserved.
//

import UIKit

class DevelopFeeViewController: IncomeCostListViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.searchHeader.orgNotNeeded = true
        self.tableView.register(UINib.init(nibName: "CostTableViewCell", bundle: Bundle.main), forCellReuseIdentifier: "CostTableViewCell")
        // Do any additional setup after loading the view.
    }
    
    override func path(for name: String) -> String {
        return DevelopFeeList
    }
    
    override func param(for name: String) -> Dictionary<String, Any> {
        var param = super.param(for: name)
        if param.keys.contains("orgCode") {
            param.removeValue(forKey: "orgCode")
        }
        return param
    }
    
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        return tableView.dequeueReusableCell(withIdentifier: "CostTableViewCell")!
    }
    
    override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 90
    }
    
    override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
        if let cel = cell as? CostTableViewCell {
            cel.model = self.source[indexPath.row]
        }
    }
    
    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let item = self.source[indexPath.row]
        let dev = DevelopDetailViewController()
        dev.title = "综合计划详情"
        dev.start = self.searchBar.text ?? ""
        dev.end = self.endDateField.text ?? ""
        dev.id = item["id"].string ?? ""
        self.push(destination: dev)
    }

}
